package com.test;

import android.Manifest;
import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Bundle;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
    @SuppressLint("SdCardPath")
    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},1);

        List<VideoBean> mList = new ArrayList<>();
        RecyclerView rv = findViewById(R.id.rv_list);

        mList.add(new VideoBean("https://img-baofun.zhhainiao.com/market/b99b51e6c7945c9d5565861d397451cb_preview.mp4","这是一条视频"));
        mList.add(new VideoBean("https://wallpaperm.cmcm.com/scene/preview_video/750c4e56cb120056c9d155b63025c564_preview.mp4","这是一条视频"));
        mList.add(new VideoBean("https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/ce9dd03aeeabe59654bbe067b35b8dd2_preview.mp4","这是一条视频"));
        mList.add(new VideoBean("https://img-baofun.zhhainiao.com/market/97ba6b60662ab4f31ef06cdf5a5f8e94_preview.mp4","这是一条视频"));


        new PagerSnapHelper().attachToRecyclerView(rv);
        rv.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        rv.setAdapter(new RVAdp(this,mList));
    }
}